<% if params[:select_person] %>
  $('#results').html("<%= escape_javascript render(partial: 'select_person') %>");
  $('#add_member').show();

<% elsif params[:select_family] %>
  $('#results').html("<%= escape_javascript render(partial: 'select_family') %>");
  $('#clear_family_form').show();
  <% if @families.empty? %>
    $('#select_family_form').hide();
    $('#no_families_found').show();
  <% else %>
    $('#select_family_form').show();
    $('#no_families_found').hide();
  <% end %>

<% else %>
  <% if @people %>
    $('#results').html("<%= escape_javascript render(partial: 'results') %>");
  <% elsif @families %>
    $('#results').html("<%= escape_javascript render(partial: 'families_results') %>");
  <% end %>

<% end %>
